using System.Collections.Generic;
using System.Linq;
using Net.Common;
using UnityEngine;

/****************************************************
// 功能：数据模型
// | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
// | Copyright (c) 2021-2025 聊来 All rights reserved.
// | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">聊来</a> )
// | @Author: 贯彻己道的云 <18970881148@qq.com>
// | DateTime: 2025/2/19 14:13:11
*****************************************************/

public class ModelManager : SingletonPatternMonoBase<ModelManager>, IManager
{

    public UserInfo userInfo = new UserInfo();

    public int mapId;

    // 参加游戏的英雄
    public List<BattleHero> battleHero;

    // 当前控制英雄的索引号
    public int currentIndex;
    
    // 房间号
    public int roomId;
    
    public string notice;

    // KCP 会话标识
    public int conv;
    
    public bool isConnected;

    public int netDelay { set; get; }

    public List<MatchPlayer> readyRoomPlayer;

    public void InitManager()
    {
        Debug.Log("ModelManager Init");
    }

    /// <summary>
    /// 更新玩家准备状态
    /// </summary>
    /// <param name="channelId"></param>
    public void UpdateRoomReadyInfo(string channelId)
    {
        foreach (var player in readyRoomPlayer.Where(player => player.channelId.Equals(channelId)))
        {
            player.ready = true;
        }
    }
}
